package com.yxplearn.mybatisplus.mybatis_sample.mapper;

import com.yxplearn.mybatisplus.mybatis_sample.pojo.Blog;
import com.yxplearn.mybatisplus.mybatis_sample.pojo.BlogAlg;
import org.apache.ibatis.annotations.MapKey;
import org.apache.ibatis.annotations.Options;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;
import java.util.Map;


public interface BlogMapper {

    Blog selectBlog(int i);

    int insertBlog(Blog blog);

    void updateOneById(@Param("id") int id, @Param("name") String name);

    void updateOneByIdMap(Map<String, Object> paramMap);

    List<Blog> selectBlogList();

    int selectCount();

    @MapKey("id")
    Map<String, Object> selectOneAsMapResult(int id);

    @MapKey("id")
    List<Map<String, Object>> selectListAsMapResult();

    @MapKey("id")
    Map<String, Object> selectListAsMapResult2();

    List<Blog> selectListLikeName(@Param("nameLike") String nameLike);

    List<Blog> selectBlogListByIds(@Param("ids") String ids);

    int insertOneAndKey(Blog xxpp);

    BlogAlg selectOneBlogAlgFromBlog(int id);

    Blog selectBlogByCondition(@Param("id") int id, @Param("name") String name, @Param("age") int age);

    List<Blog> selectBlogByArray(List<Integer> ids);

    @Select("select * from blog where id = #{id}")
    @Options(useCache = true)
    Blog selectOneCache(int id);

    int insertList(List<Blog> blogList);
}
